
<html>
  
  <HEAD>
    
    <link rel="stylesheet" href="style/default.css" type="text/css">
    
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  
    <title>JAXB RI 2.1.9 fcs -- Sample Apps Readme
    </title>
    <link rel="alternate" href="https://jaxb.dev.java.net/servlets/ProjectNewsRSS" type="application/rss+xml">
  </HEAD>

  
  <BODY>
    <h1>
      <banner>
    Java
        <sup>
          <font size="-2">TM</font>
        </sup> Architecture for XML Binding
  
      </banner>
      <br>
      Sample Apps Readme 
    
    </h1>
    <center>
      <b>Implementation Version:</b> 2.1.9 fcs
      <br>
    </center>
    <table class="navbar" cellspacing="0">
      <tr>
        <td class="active">
          <a>JAXB 2.0</a>
        </td>
        <td class="inactive">
          <a href="xjc.html">Tools</a>
        </td>
        <td class="inactive">
          <a href="jaxb-1_0.html">JAXB 1.0.x</a>
        </td>
        <td class="inactive">
          <a href="vendor.html">JAXB RI Extensions</a>
        </td>
        <td class="inactive">
          <a href="community.html">JAXB Community</a>
        </td>
      </tr>
    </table>
    <div class="subnavbar">
      <ul>
        <li class="first">
          <a href="index.html">
            <span>Overview </span>
          </a>
        </li>
        <li>
          <a href="ReleaseNotes.html">
            <span>Release Notes </span>
          </a>
        </li>
        <li>
          <a href="samples.html">
            <span class="active">Sample Apps </span>
          </a>
        </li>
        <li>
          <a href="changelog2.html">
            <span>Changelog </span>
          </a>
        </li>
      </ul>
    </div>
    
    <header></header>

    This page summarizes basic use-cases for Java-2-Schema, Schema-2-Java, and lists all
    of the sample applications that ship with JAXB.

    
    <h2>Using the Runtime Binding Framework</h2>
    
    <h3>Schema-2-Java</h3>
    
    <p>Schema-2-Java is the process of compiling one or more schema files into generated
       Java classes.  Here are some of the basic steps for developing an app:

    
    <ol>
      
      <li>Develop/locate your schema</li>
      
      <li>Annotate the schema with binding customizations if necessary (or place them
          in an external bindings file)</li>
      
      <li>Compile the schema with the XJC binding compiler</li>
      
      <li>Develop your JAXB client application using the Java content classes
          generated by the XJC binding compiler along with the
          
        <tt>javax.xml.bind</tt> runtime framework
      </li>
      
      <li>Set your CLASSPATH to include all of the 
        <a href="ReleaseNotes.html#jars">JAR files</a>
      </li>
      
      <li>Compile all of your Java sources with 
        <tt>javac</tt>
      </li>
      
      <li>Run it!</li>
    
    </ol>

    
    <h3>Java-2-Schema</h3>
    
    <p>Java-2-Schema is the process of augmenting existing Java classes with the annotations
       defined in the 
      <tt>javax.xml.bind.annotation</tt> package so that the JAXB runtime
       binding framework is capable of performing the un/marshal operations.  Here are the
       basic steps for developing an app:
    

    
    <ol>
      
      <li>Develop your data model in Java</li>
      
      <li>Apply the 
        <tt>javax.xml.bind.annotation</tt> annotations to control the binding process
      </li>
      
      <li>Set your CLASSPATH to include all of the 
        <a href="ReleaseNotes.html#jars">JAR files</a>
      </li>
      
      <li>Compile your data model with 
        <tt>javac</tt> (Important! make sure that you classpath includes
          jaxb-xjc.jar before running javac)
      </li>
      
      <li>The resulting class files will contain your annotations as well other default annotations
          needed by the JAXB runtime binding framework</li>
      
      <li>Develop your client application that uses the data model and develop the code that uses the
          JAXB runtime binding framework to persist your data model using the un/marshal operations.</li>
      
      <li>Compile and run your client application!</li>
    
    </ol>

    
    <p>For more information about this process, see the the
       
      <a href="http://java.sun.com/webservices/tutorial.html">Java WSDP Tutorial</a>
       and the extensive 
      <a href="samples.html">sample application</a> documentation.
    


	
    <h3>Building and Running the Sample Apps with Ant</h3>
	
    
    <p>To run the sample applications, just go into each sample directory, and run 
      <tt>ant</tt> without any option.
    

    
    <p>A few sample applications do 
      <em>not</em> use Ant.  For
       those samples, refer to the included 
      <tt>readme.txt</tt> files for 
       instructions.
    


    
    <a name="samples"></a>
    
    <h3>List of Sample Apps</h3>
    
    
    
    <dl class="sample-list">
      <dt>
        <a href="../samples/{file.name}">dtd</a>
      </dt>
      <dd>
        This sample application illustrate some of the DTD support available in 
        the JAXB RI's extension mode. Please refer to the &lt;a href="vendor.html&gt;
        Vendor Extensions&lt;/a&gt; page for more detail.
    </dd>
      <dt>
        <a href="../samples/{file.name}">Universal Business Language (UBL)</a>
      </dt>
      <dd>
This project processes a UBL (Universal Business Language) order
instance and prints a report to the screen.</dd>
      <dt>
        <a href="../samples/{file.name}">XML message passing via socket</a>
      </dt>
      <dd>
      This example demonstrates how one can use one communication channel
      (such as a socket) to send multiple XML messages, and how it can be
      combined with JAXB.
    </dd>
      <dt>
        <a href="../samples/{file.name}">ClassResolver</a>
      </dt>
      <dd>
      This little DI-container-by-JAXB example demonstrates how one can avoid
      passing in a list of classes upfront, and instead load classes lazily.
    </dd>
      <dt>
        <a href="../samples/{file.name}">catalog resolver</a>
      </dt>
      <dd>
        This example demonstrates how to use the "-catalog"
        compiler switch to handle references to schemas
        in external web sites.
    </dd>
      <dt>
        <a href="../samples/{file.name}">Java to Schema Binding</a>
      </dt>
      <dd>
      This sample application demonstrates marshalling, unmarshalling and
      unmarshal validation with existing Java classes annotated with 
      JAXB annotations.
    </dd>
      <dt>
        <a href="../samples/{file.name}">Using unmarshaller (formerly SampleApp1)</a>
      </dt>
      <dd>
      This sample application demonstrates how to unmarshal an instance document
      into a Java content tree and access data contained within it.
    </dd>
      <dt>
        <a href="../samples/{file.name}">Ordering Properties and Fieldes in Java to Schema Bindings</a>
      </dt>
      <dd>
      This sample application demonstrates the use of mapping annotations
      @XmlAccessorOrder and @XmlType.propOrder in Java classes for ordering 
      properties and fields in Java to schema bindings.
    </dd>
      <dt>
        <a href="../samples/{file.name}">Updateable Partial Binding using Binder</a>
      </dt>
      <dd>
      This sample application demonstrates how to partially map a DOM tree
      to JAXB (using JAXP 1.3 XPath), modify JAXB mapped instance and then update modifications back to
      the DOM tree.
    </dd>
      <dt>
        <a href="../samples/{file.name}">partial-unmarshalling</a>
      </dt>
      <dd>
        In this example, the input document will be unmarshalled a small chunk 
        at a time, instead of unmarshalling the whole document at once.
    </dd>
      <dt>
        <a href="../samples/{file.name}">locator-support</a>
      </dt>
      <dd>
        This sample shows how to use the new non-standard locator support.  By 
        following the instructions in the readme.txt file, you can cause all of 
        the generated impl classes to implement a new interface that provides 
        more information about error locations.  When a ValidationEvent happens 
        on your content tree, simply retrieve the object and cast it down to 
        &lt;tt&gt;com.sun.xml.bind.extra.Locatable&lt;/tt&gt;.
    </dd>
      <dt>
        <a href="../samples/{file.name}">Ordering Properties and Fieldes in Java to Schema Bindings</a>
      </dt>
      <dd>
      This sample application demonstrates the use of mapping annotations
      @XmlAccessorOrder and @XmlType.propOrder in Java classes for ordering 
      properties and fields in Java to schema bindings.
    </dd>
      <dt>
        <a href="../samples/{file.name}">element-substitution</a>
      </dt>
      <dd>
        This sample application illustrates how W3C XML Schema substitution 
        groups are supported in JAXB RI's extension mode. Please refer to the 
        &lt;a href="vendor.html"&gt;Vendor Extensions&lt;/a&gt; page for more detail.
    </dd>
      <dt>
        <a href="../samples/{file.name}">datatypeconverter (formerly SampleApp7)</a>
      </dt>
      <dd>
        This sample application is very similar to the inline-customize sample 
        application (formerly SampleApp6), but illustrates an easier, but not 
        as robust, &lt;jaxb:javaType&gt; customization.
    </dd>
      <dt>
        <a href="../samples/{file.name}">external-customize (formerly SampleApp8)</a>
      </dt>
      <dd>
        This sample application is identical to the datatypeconverter sample 
        application (formerly SampleApp7) except that the binding customizations 
        are contained in an external binding file.
    </dd>
      <dt>
        <a href="../samples/{file.name}">create-marshal (formerly SampleApp3)</a>
      </dt>
      <dd>
        This sample application demonstrates how to use the ObjectFactory 
        class to create a Java content tree from scratch and marshal it to 
        XML data. It also demonstrates how to add content to a JAXB List 
        property.
    </dd>
      <dt>
        <a href="../samples/{file.name}">fix-collides (formerly part of SampleApp9)</a>
      </dt>
      <dd>
        Another binding customization example that illustrates how to resolve 
        name conflicts. Running this sample without the binding file will
        result in name collisions (see readme.txt) . Running "ant" will use 
        the binding customizations to resolve the name conflicts while 
        compiling the schema.
    </dd>
      <dt>
        <a href="../samples/{file.name}">pull parser based unmarshalling</a>
      </dt>
      <dd>
      This sample app demonstrates how a pull-parser can
      be used with JAXB to increase the flexibility of processing.
    </dd>
      <dt>
        <a href="../samples/{file.name}">RI-specific customizations</a>
      </dt>
      <dd>
			This example demonstrates how to use 
			&lt;xjc:superClass&gt; vendor extensions provided by Sun's JAXB RI,
			as well as &lt;jaxb:serializable&gt; customization.
    </dd>
      <dt>
        <a href="../samples/{file.name}">character-escape</a>
      </dt>
      <dd>This example shows how you can use the new JAXB RI Marshaller 
        property "com.sun.xml.bind.characterEscapeHandler" to change 
        the default character escaping behavior.</dd>
      <dt>
        <a href="../samples/{file.name}">Adapters for custom marshaling/unmarshaling XML content</a>
      </dt>
      <dd>
      This sample application demonstrates the use of interface XmlAdapter 
      and annotation XmlJavaTypeAdapter for custom marshaling/unmarshaling 
      XML content into/out of a Java type.
    </dd>
      <dt>
        <a href="../samples/{file.name}">Streaming Unmarshalling w/o StAX</a>
      </dt>
      <dd>
        This example illustrates a different approach to the streaming unmarshalling,
        which is suitable for processing a large document.
    </dd>
      <dt>
        <a href="../samples/{file.name}">Application-driven cycle handling</a>
      </dt>
      <dd>
      JAXB RI's vendor extension "CycleRecoverable" provides application a hook to handle
      cycles in the object graph. Advanced.
    </dd>
      <dt>
        <a href="../samples/{file.name}">validating unmarshaller (formerly SampleApp4)</a>
      </dt>
      <dd>
			This sample application demonstrates how to enable
			validation during the unmarshal operations.
    </dd>
      <dt>
        <a href="../samples/{file.name}">Type substitutoin support</a>
      </dt>
      <dd>
      This sample app demonstrates type substitution using
      the W3C XML Schema Part 0: Primer international purchase order schema.
    </dd>
      <dt>
        <a href="../samples/{file.name}">namespace-prefix</a>
      </dt>
      <dd>
        This sample application demonstrates how to use the new JAXB RI 
        Marshaller property "com.sun.xml.bind.namespacePrefixMapper" to 
        customize the namespace prefixes generated during marshalling.
    </dd>
      <dt>
        <a href="../samples/{file.name}">Defining XML elements via @XmlRootElement</a>
      </dt>
      <dd>
      This sample application demonstrates the use of annotation
      @XmlRootElement to define a class to be an XML element.
    </dd>
      <dt>
        <a href="../samples/{file.name}">@XmlAttribute used to define properties and fields as XML Attributes</a>
      </dt>
      <dd>
      This sample application demonstrates the use of annotation
      @XmlAttribute for defining Java properties and fields as
      XML attributes.
    </dd>
      <dt>
        <a href="../samples/{file.name}">Generating synchronized methods</a>
      </dt>
      <dd>
      This sample shows how to use the new non-standard synchronized
      method support. By following the instructions in the readme.txt,
      you can cause all of the generated impl class methods signatures
      to contain the "synchronized" keyword.
    </dd>
      <dt>
        <a href="../samples/{file.name}">Marshalling output customization</a>
      </dt>
      <dd>
        A common customization need for the marshalling output is
        about introducing extra processing instruction and/or DOCTYPE declaration.
        This example demonstrates how such modification can be done easily.
    </dd>
      <dt>
        <a href="../samples/{file.name}">Annotation @XmlSchemaType is used to customize the mapping of a 
	property or field to an XML built-in type.</a>
      </dt>
      <dd>
      This sample application demonstrates the use of annotation
      @XmlSchemaType to customize the mapping of a property or field to 
      an XML built-in type.
    </dd>
      <dt>
        <a href="../samples/{file.name}">modify-marshal (formerly SampleApp2)</a>
      </dt>
      <dd>
        This sample application demonstrates how to modify a java content tree 
        and marshal it back to XML data.
    </dd>
      <dt>
        <a href="../samples/{file.name}">inline-customize (formerly SampleApp6)</a>
      </dt>
      <dd>
        This sample application demonstrates how to customize the default 
        binding produced by the XJC binding compiler.
    </dd>
    </dl>

	
    <hr>
	
    <div class="footer">
	  $Revision: 1.1 $
      <br>
	  $Date: 2007/12/05 00:49:15 $
	
    </div>
  

    
  </BODY>
</html>